using System;
using System.Data;
using System.Collections.Generic;
using Soccer.Core;
using Soccer.Utility;

namespace Soccer.Business
{
    [TableAttribute("Comments")]
	[Serializable]
    public class Comment : DBO<Comment>
    {
		#region Fields
		
		private int? _IdComment;
		private string _CommentDetail;
		private int? _IdParent;
		private int? _IdUser;
		private bool? _IsApproved;
		private DateTime? _CreatedDate;
		private DateTime? _LastModifiedDate;
		private int? _IdNews;
		private int? _IdMatch;
		
		#endregion
		
		#region Constructors
		/// <summary>
		/// Default constructor
		/// </summary>
		public Comment()
		{
			
		}
		
		/// <summary>
		/// Constructor with IdComment 
		/// </summary>
		/// <param name="IdComment">The IdComment</param>
		public Comment(int? IdComment )
		{
			this.IdComment = IdComment;
		}
		
		/// <summary>
		/// Constructor with all parameters
		/// </summary>
		/// <param name="IdComment">Sets int? value for IdComment</param>
		/// <param name="CommentDetail">Sets string value for CommentDetail</param>
		/// <param name="IdParent">Sets int? value for IdParent</param>
		/// <param name="IdUser">Sets int? value for IdUser</param>
		/// <param name="IsApproved">Sets bool? value for IsApproved</param>
		/// <param name="CreatedDate">Sets DateTime? value for CreatedDate</param>
		/// <param name="LastModifiedDate">Sets DateTime? value for LastModifiedDate</param>
		/// <param name="IdNews">Sets int? value for IdNews</param>
		/// <param name="IdMatch">Sets int? value for IdMatch</param>
		public Comment(int? idComment, string commentDetail, int? idParent, int? idUser, bool? isApproved, DateTime? createdDate, DateTime? lastModifiedDate, int? idNews, int? idMatch)
		{
			this.IdComment = idComment;
			this.CommentDetail = commentDetail;
			this.IdParent = idParent;
			this.IdUser = idUser;
			this.IsApproved = isApproved;
			this.CreatedDate = createdDate;
			this.LastModifiedDate = lastModifiedDate;
			this.IdNews = idNews;
			this.IdMatch = idMatch;
		}
		
		#endregion
		
		#region Properties
		
		/// <summary>
		/// Gets or sets int? value for IdComment
		/// </summary>
		[ColumnAttribute("IdComment", SqlDbType.Int , 4 , true, true, false)]
		public int? IdComment
		{
			set
			{
				this._IdComment = value;
			}
			get
			{
				return this._IdComment;
			}
		}
		
		/// <summary>
		/// Gets or sets string value for CommentDetail
		/// </summary>
		[ColumnAttribute("CommentDetail", SqlDbType.NVarChar , -1 , false, false, true)]
		public string CommentDetail
		{
			set
			{
				this._CommentDetail = value;
			}
			get
			{
				return this._CommentDetail;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdParent
		/// </summary>
		[ColumnAttribute("IdParent", SqlDbType.Int , 4 , false, false, true)]
		public int? IdParent
		{
			set
			{
				this._IdParent = value;
			}
			get
			{
				return this._IdParent;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdUser
		/// </summary>
		[ColumnAttribute("IdUser", SqlDbType.Int , 4 , false, false, true)]
		public int? IdUser
		{
			set
			{
				this._IdUser = value;
			}
			get
			{
				return this._IdUser;
			}
		}
		
		/// <summary>
		/// Gets or sets bool? value for IsApproved
		/// </summary>
		[ColumnAttribute("IsApproved", SqlDbType.Bit , 1 , false, false, true)]
		public bool? IsApproved
		{
			set
			{
				this._IsApproved = value;
			}
			get
			{
				return this._IsApproved;
			}
		}
		
		/// <summary>
		/// Gets or sets DateTime? value for CreatedDate
		/// </summary>
		[ColumnAttribute("CreatedDate", SqlDbType.DateTime , 8 , false, false, true)]
		public DateTime? CreatedDate
		{
			set
			{
				this._CreatedDate = value;
			}
			get
			{
				return this._CreatedDate;
			}
		}
		
		/// <summary>
		/// Gets or sets DateTime? value for LastModifiedDate
		/// </summary>
		[ColumnAttribute("LastModifiedDate", SqlDbType.DateTime , 8 , false, false, true)]
		public DateTime? LastModifiedDate
		{
			set
			{
				this._LastModifiedDate = value;
			}
			get
			{
				return this._LastModifiedDate;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdNews
		/// </summary>
		[ColumnAttribute("IdNews", SqlDbType.Int , 4 , false, false, true)]
		public int? IdNews
		{
			set
			{
				this._IdNews = value;
			}
			get
			{
				return this._IdNews;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdMatch
		/// </summary>
		[ColumnAttribute("IdMatch", SqlDbType.Int , 4 , false, false, true)]
		public int? IdMatch
		{
			set
			{
				this._IdMatch = value;
			}
			get
			{
				return this._IdMatch;
			}
		}
		
		/// <summary>
		/// Get a Comment object of current object base on IdParent
		/// </summary>
		public Comment ParentComment
		{
			get
			{
				if (this.IdParent == null)
					return null;
					
				Comment condition = new Comment(this.IdParent);
				return CommentController.FindItem(condition);
			}
		}
		
		/// <summary>
		/// Get a Newse of current Comment object base on IdNews
		/// </summary>
		public Newse News
		{
			get
			{
				if (this.IdNews == null)
					return null;
	
				Newse condition = new Newse(this.IdNews);
				return NewseController.FindItem(condition);
			}
		}
		
		/// <summary>
		/// Get a User of current Comment object base on IdUser
		/// </summary>
		public User User
		{
			get
			{
				if (this.IdUser == null)
					return null;
	
				User condition = new User(this.IdUser);
				return UserController.FindItem(condition);
			}
		}
		
		#endregion
        
        #region Other Properties
        private static ColumnNameStruct? _ColumnName;
        public static ColumnNameStruct ColumnName
        {
            get
            {
                if (!_ColumnName.HasValue)
                    _ColumnName = new ColumnNameStruct();
                return _ColumnName.Value;
            }
        }
        #endregion

        #region NestedType
        public  struct ColumnNameStruct
        {
            /// <summary>
            /// Get the name of column [IdComment]
            /// </summary>
            public string IdComment
            {
                get
                {
                    return "IdComment";
                }
            }
            /// <summary>
            /// Get the name of column [CommentDetail]
            /// </summary>
            public string CommentDetail
            {
                get
                {
                    return "CommentDetail";
                }
            }
            /// <summary>
            /// Get the name of column [IdParent]
            /// </summary>
            public string IdParent
            {
                get
                {
                    return "IdParent";
                }
            }
            /// <summary>
            /// Get the name of column [IdUser]
            /// </summary>
            public string IdUser
            {
                get
                {
                    return "IdUser";
                }
            }
            /// <summary>
            /// Get the name of column [IsApproved]
            /// </summary>
            public string IsApproved
            {
                get
                {
                    return "IsApproved";
                }
            }
            /// <summary>
            /// Get the name of column [CreatedDate]
            /// </summary>
            public string CreatedDate
            {
                get
                {
                    return "CreatedDate";
                }
            }
            /// <summary>
            /// Get the name of column [LastModifiedDate]
            /// </summary>
            public string LastModifiedDate
            {
                get
                {
                    return "LastModifiedDate";
                }
            }
            /// <summary>
            /// Get the name of column [IdNews]
            /// </summary>
            public string IdNews
            {
                get
                {
                    return "IdNews";
                }
            }
            /// <summary>
            /// Get the name of column [IdMatch]
            /// </summary>
            public string IdMatch
            {
                get
                {
                    return "IdMatch";
                }
            }
        }
        #endregion
    }
}
